﻿<navigation:Page
    xmlns:my1="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    x:Class="TheOliver.DigitalSignage.Admin.Views.Session"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    d:DesignWidth="640"
    d:DesignHeight="480"
    Title="Session Page"
    xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria"
    xmlns:my="clr-namespace:Web.Services"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input">

    <my1:BusyIndicator
        IsBusy="{Binding ElementName=sessionDomainDataSource, Path=DomainContext.IsLoading}">
        <Grid
            x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition
                    Height="0.5*" />
                <RowDefinition
                    Height="0.5*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition
                    Width="0.5*" />
                <ColumnDefinition
                    Width="0.5*" />
            </Grid.ColumnDefinitions>
            <riaControls:DomainDataSource
                AutoLoad="True"
                Height="0"
                LoadedData="sessionDomainDataSource_LoadedData"
                Name="sessionDomainDataSource"
                QueryName="GetSessionQuery"
                Width="0"
                Margin="320,11,2,240"
                Grid.Row="1">
                <riaControls:DomainDataSource.DomainContext>
                    <my:DigitalSignageDomainContext />
                </riaControls:DomainDataSource.DomainContext>
            </riaControls:DomainDataSource>
            <data:DataGrid
                AutoGenerateColumns="False"
                ItemsSource="{Binding ElementName=sessionDomainDataSource, Path=Data}"
                Name="sessionDataGrid"
                RowDetailsVisibilityMode="VisibleWhenSelected"
                Grid.ColumnSpan="2" Margin="8">
                <data:DataGrid.Columns>
                    <data:DataGridTextColumn
                        x:Name="titleColumn"
                        Binding="{Binding Path=Title}"
                        Header="Title"
                        Width="300" />
                    <data:DataGridTextColumn
                        x:Name="shortTitleColumn"
                        Binding="{Binding Path=ShortTitle}"
                        Header="ShortTitle"
                        Width="300" />
                    <data:DataGridTextColumn
                        x:Name="abstractColumn"
                        Binding="{Binding Path=Abstract}"
                        Header="Abstract"
                        Width="400" />
                    
                </data:DataGrid.Columns>
            </data:DataGrid>
            <Grid
                DataContext="{Binding ElementName=sessionDataGrid, Path=SelectedItem, Mode=TwoWay}"
                Grid.Row="1"
                Margin="8"
                x:Name="_detailsGrid">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="71" />
                    <ColumnDefinition Width="233" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition
                        Height="Auto" />
                    <RowDefinition
                        Height="Auto" />
                    <RowDefinition
                        Height="Auto" />
                </Grid.RowDefinitions>

                <dataInput:Label
                    Content="Title:"
                    Grid.Column="0"
                    Grid.Row="0"
                    HorizontalAlignment="Left"
                    Margin="3"
                    VerticalAlignment="Top" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="0"
                    Margin="3"
                    Name="titleTextBox"
                    Text="{Binding Path=Title, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" />

                <dataInput:Label
                    Content="ShortTitle:"
                    Grid.Column="0"
                    Grid.Row="1"
                    HorizontalAlignment="Left"
                    Margin="3"
                    VerticalAlignment="Top" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="1"
                    Margin="3"
                    Name="shortTitleTextBox"
                    Text="{Binding Path=ShortTitle, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" />


                <dataInput:Label
                    Content="Abstract:"
                    Grid.Column="0"
                    Grid.Row="2"
                    HorizontalAlignment="Left"
                    Margin="3"
                    VerticalAlignment="Center" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="2"
                    Margin="3,3,3,-134"
                    Name="abstractTextBox"
                    Text="{Binding Path=Abstract, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" 
                    TextWrapping="Wrap" />
            </Grid>
            <StackPanel
                HorizontalAlignment="Right"
                Margin="0,8,8,0"
                Name="_eventPanel"
                Orientation="Horizontal"
                VerticalAlignment="Top"
                Grid.Column="1"
                Grid.Row="1">
                <Button
                    Click="_addNew_Click"
                    Content="New Session"
                    Margin="0"
                    Name="_addNew" />
                <Button
                    Click="_delete_Click"
                    Content="Delete Session"
                    Margin="0"
                    Name="_delete" />
            </StackPanel>
            <StackPanel
                HorizontalAlignment="Right"
                Margin="0,0,8,8"
                Name="_changesPanel"
                Orientation="Horizontal"
                VerticalAlignment="Bottom"
                Grid.Column="1"
                Grid.Row="1">
                <Button
                    Click="_save_Click"
                    Content="Save changes"
                    IsEnabled="{Binding ElementName=sessionDomainDataSource, Path=DomainContext.HasChanges}"
                    Name="_save" />
                <Button
                    Click="_reject_Click"
                    Content="Reject changes"
                    IsEnabled="{Binding ElementName=sessionDomainDataSource, Path=DomainContext.HasChanges}"
                    Name="_reject" />
            </StackPanel>
            
        </Grid>
    </my1:BusyIndicator>
</navigation:Page>
